Repository navigation
Fix registry auth to send base64url-encoded X-Registry-Auth header - #105
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused encoding fix matches Docker’s requirements, and the regression test covers both affected characters.
No open issues 🎉
What changed in this PR
Fixes registry authentication for imageCreate() and imagePush() by sending Docker-compatible base64url headers.
Changes:
- Updates the shared encoder and its documentation.
- Adds a regression test covering both character substitutions.
| File | Description |
|---|---|
| tests/ClientTest.php | Verifies the encoded registry-auth header during image push. |
| src/Client.php | Converts base64 + and / to base64url - and _. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changeset fixes the registry authentication for
imageCreate()andimagePush()to send theX-Registry-Authheader base64url-encoded as Docker expects. It previously used standard base64, so whenever the encoded credentials happened to contain a+or/, Docker could not decode the header and ignored the credentials. This only affected some credentials, which likely explains why it went unnoticed since the very first release in 2014.Refs https://github.com/moby/moby/blob/docker-v29.9.1/api/pkg/authconfig/authconfig.go